from enum import Enum
from models.payment import PaymentMethod

class ProductCategory(Enum):
    FOOD = "食品"
    SERVICE = "服务"

class Product:
    def __init__(
        self, 
        name: str, 
        price: float = 0.0, 
        points_cost: int = 0,  # 添加积分成本参数
        coupon_cost: int = 0,  # 添加优惠券成本参数
        category: ProductCategory = None
    ):
        self.name = name
        self.price = price          # 现金/余额价格
        self.points_cost = points_cost  # 积分成本
        self.coupon_cost = coupon_cost  # 优惠券成本
        self.category = category

    def get_cost(self, payment_method: PaymentMethod) -> float:
        """根据支付方式返回对应成本"""
        if payment_method == PaymentMethod.POINTS:
            return self.points_cost
        elif payment_method == PaymentMethod.COUPON:
            return self.coupon_cost
        return self.price  # 默认返回现金/余额价格